﻿//********************************************************************************//
//创建日期：<创建日期，2016-05-11>
//创建作者：<郭登杰>
//功能说明：来函流程公共控件-右侧上部信息1
//********************************************************************************//
using DevExpress.Web;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Entity;
using BLL;
using BLL.Access;
using Platform.Http;
using Web.Class;
using Platform.Common;
using System.Text;

namespace Web.Controls.LAIHAN
{
    public partial class UCLHLCTOPINFO1 : System.Web.UI.UserControl, IUCLHOperate
    {
        #region 属性

        /// <summary>
        /// 来函ID
        /// </summary>
        public string LaiHanID { get; set; }

        /// <summary>
        /// 来函类型
        /// </summary>
        public eLaiHanLX LaiHanLX { get; set; }

        /// <summary>
        /// 来函流程
        /// </summary>
        public eLaiHanLCBH LaiHanLC { get; set; }

        /// <summary>
        /// 当前选中管理块
        /// </summary>
        public string GuanLiKH
        {
            get
            {
                string t = Convert.ToString(this.concmbGLK.Value);
                return t == "-1" ? null : t;
            }
        }

        /// <summary>
        /// 当前文本框来函编号
        /// </summary>
        public string LaiHanBH
        {
            get
            {
                return this.contxtLaiHanBH.Text;
            }
        }

        /// <summary>
        /// 当前选中业务员
        /// </summary>
        public string YWY
        {
            get
            {
                string t = Convert.ToString(this.concmbYWY.Value);
                return t == "-1" ? null : t;
            }
        }

        /// <summary>
        /// 当前输入用户号
        /// </summary>
        public string YongHuH
        {
            get
            {
                string t = Convert.ToString(this.contxtYonghuh.Text);
                return t == "" ? null : t;
            }
        }

        /// <summary>
        /// 当前复审修改
        /// </summary>
        public string FuShenXG
        {
            get
            {
                if (!this.concbFuShenXG.Visible)
                {
                    return null;
                }
                else
                {
                    return this.concbFuShenXG.Checked ? "1" : "0";
                }
            }
        }

        #endregion

        #region 事件

        /// <summary>
        /// 页面加载事件
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitControl();
            }
        }

        /// <summary>
        /// 执行后台事件
        /// </summary>
        protected void btnActPerform_Click(object sender, EventArgs e)
        {
            UCLHLCLAIHANXX uc = this.Parent.FindControl("UCLHLCLAIHANXX") as UCLHLCLAIHANXX;
            uc.BindList(this.GuanLiKH, this.LaiHanBH, this.YongHuH, this.YWY, this.FuShenXG);
        }

        #endregion

        #region 方法

        /// <summary>
        /// 初始化控件
        /// </summary>
        public void InitControl()
        {
            //加载管理块
            PageTools.LoadCombox(this.concmbGLK, PageTools.eLoadType.管理块, BusinessTool.ZHANDIANBH(), "-", "");
            //加载业务员
            PageTools.LoadCombox(this.concmbYWY, PageTools.eLoadType.业务员, BusinessTool.ZHANDIANBH(), "-", "");
            //主任以后查询条件才可选业务员
            this.tdYWY.Visible = ((int)this.LaiHanLC >= (int)eLaiHanLCBH.主任);
            this.tdYWY2.Visible = ((int)this.LaiHanLC >= (int)eLaiHanLCBH.主任);
            //仅有来函类型为计划变更并且当前流程为主任及以后时,查询条件才显示业务员建议量
            if (this.LaiHanLX == eLaiHanLX.计划变更 && (int)this.LaiHanLC >= (int)eLaiHanLCBH.主任)
            {
                this.tabYWYJY.Visible = true;
            }
            else
            {
                this.tabYWYJY.Visible = false;
            }
            //仅当前步骤为计财科时
            this.concbFuShenXG.Visible = (this.LaiHanLC == eLaiHanLCBH.计财科);
        }

        /// <summary>
        /// 提交验证
        /// </summary>
        public ValidateRS Validate()
        {
            ValidateRS rs = new ValidateRS();
            rs.IsSuccess = true;
            return rs;
        }

        /// <summary>
        /// 清空信息
        /// </summary>
        public void ClearInfo()
        {
            this.lblTiaoZhengN.Text = "";
        }

        /// <summary>
        /// 根据来函加载信息
        /// </summary>
        public void LoadInfo(YS_LH_LAIHANXX laihanxx)
        {
            this.lblTiaoZhengN.Text = "调整年月：" + laihanxx.I_TZY.ToString() + (laihanxx.I_TZM != null ? "年 " + laihanxx.I_TZM + "月" : "");
        }

        #endregion
    }
}